package com.sitech.portal.menus.action;

import com.opensymphony.xwork2.ActionSupport;
import com.sitech.portal.menus.service.MenuService;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;
import java.util.Map;

/**
 * Created by liujhc on 1/9.
 */
public class MenuAction extends ActionSupport {
    @Autowired
    private MenuService menuService;
    private List<Map> subSystems;
    private List<Map> menus;
    private String systemId;
    private String keyword;
    private String limit = "10";


    public String subSystems() {
        subSystems = menuService.getSubSystems();
        return SUCCESS;
    }

    public String menus() {
        menus = menuService.getMenus(systemId);
        return SUCCESS;
    }

    public String menusSearch() {
        menus = menuService.selectModuleForTokenInput(keyword,limit);
        return SUCCESS;
    }

    public List<Map> getMenus() {
        return menus;
    }

    public List<Map> getSubSystems() {
        return subSystems;
    }

    public void setSystemId(String systemId) {
        this.systemId = systemId;
    }

    public String getLimit() {
        return limit;
    }

    public void setLimit(String limit) {
        this.limit = limit;
    }

    public String getKeyword() {
        return keyword;
    }

    public void setKeyword(String keyword) {
        this.keyword = keyword;
    }
}
